<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<!-- BEGIN HEAD -->
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="width=device-width, initial-scale=1" name="viewport"/>
    <meta name="description" content="Responsive Admin Template"/>
    <meta name="author" content="SmartUniversity"/>
    <title>Spice Hotel | Bootstrap 4 Admin Dashboard Template + UI Kit</title>
    <!-- google font -->
    <link href="https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700" rel="stylesheet" type="text/css"/>
    <!-- icons -->
    <link th:href="@{/assets/plugins/simple-line-icons/simple-line-icons.min.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/assets/plugins/font-awesome/css/font-awesome.min.css}" rel="stylesheet" type="text/css"/>
    <!--bootstrap -->
    <link th:href="@{/assets/plugins/bootstrap/css/bootstrap.css}" rel="stylesheet" type="text/css"/>
    <!-- Material Design Lite CSS -->
    <link rel="stylesheet" th:href="@{/assets/plugins/material/material.min.css}">
    <link rel="stylesheet" th:href="@{/assets/css/material_style.css}">

    <!-- data tables -->
    <link th:href="@{/assets/plugins/datatables/plugins/bootstrap/dataTables.bootstrap4.min.css}" rel="stylesheet"
          type="text/css"/>
    <!-- animation -->
    <link th:href="@{/assets/css/pages/animate_page.css}" rel="stylesheet">
    <!-- Template Styles -->
    <link th:href="@{/assets/css/style.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/assets/css/plugins.min.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/assets/css/responsive.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/assets/css/theme-color.css}" rel="stylesheet" type="text/css"/>

    <!-- favicon -->
    <link rel="shortcut icon" th:href="@{/assets/img/favicon.ico}"/>
</head>
<!-- END HEAD -->
<body class="page-header-fixed sidemenu-closed-hidelogo page-content-white page-md header-white dark-sidebar-color logo-dark">
<div class="page-wrapper">
    <!-- start header -->
    <div th:replace="~{commons::headnavbar}"></div>

    <!-- end header -->

    <!-- start page container -->
    <div class="page-container">
        <!-- start sidebar menu -->
        <div th:replace="~{commons::sidebar(active='all_users',open='user')}"></div>

        <!-- end sidebar menu -->

        <!-- start page content -->
        <div class="page-content-wrapper">
            <div class="page-content">
                <div class="page-bar">
                    <div class="page-title-breadcrumb">
                        <div class=" pull-left">
                            <div class="page-title">All Users</div>
                        </div>
                        <ol class="breadcrumb page-breadcrumb pull-right">
                            <li><i class="fa fa-home"></i>&nbsp;<a class="parent-item" th:href="@{/index.html}">Users</a>&nbsp;<i
                                    class="fa fa-angle-right"></i>
                            </li>
                            <li><a class="parent-item" href="">Users</a>&nbsp;<i class="fa fa-angle-right"></i>
                            </li>
                            <li class="active">All Users</li>
                        </ol>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-12">
                        <div class="card card-box">
                            <div class="card-head">
                                <header>All Users</header>
                                <div class="tools">
                                    <a class="fa fa-repeat btn-color box-refresh" href="javascript:;"></a>
                                    <a class="t-collapse btn-color fa fa-chevron-down" href="javascript:;"></a>
                                    <a class="t-close btn-color fa fa-times" href="javascript:;"></a>
                                </div>
                            </div>
                            <div class="card-body ">


                                <div class="table-scrollable">
                                    <table class="table table-hover table-checkable order-column full-width"
                                           id="example4">
                                        <thead>
                                        <tr>

                                            <th class="center"> 用户编号</th>
                                            <th class="center"> 用户姓名</th>
                                            <th class="center"> 密码</th>
                                            <th class="center"> 角色</th>
                                            <th class="center"> 更改权限</th>
                                        </tr>
                                        </thead>
                                        <tbody>

                                        <tr th:each="user:${userWithAuth}" class="odd gradeX">

                                            <td class="center" th:text="${user.id}" th:if="${user.role}!=null"></td>
                                            <td class="center" th:text="${user.username}"
                                                th:if="${user.role}!=null"></td>
                                            <td class="center" th:text="${user.password}"
                                                th:if="${user.role}!=null"></td>
                                            <td class="center" th:text="${user.role.name}"
                                                th:if="${user.role}!=null"></td>

                                            <td class="center" th:if="${user.role}!=null">
                                                <!--修改按钮-->
                                                <button class="btn btn-tbl-edit btn-xs showUpdateUser"
                                                        data-toggle="modal"
                                                        data-target="#changeRoleModal"
                                                        th:value="${user.id}">
                                                    <i class="fa fa-pencil"></i>
                                                </button>
                                            </td>

                                        </tr>

                                        <!--th:href="@{/room/}+${room.rid}"  原始修改跳转
                                        th:href="@{/room}+${room.rid}"  原始删除-->
                                        </tbody>
                                    </table>


                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- end page content -->

        <div th:replace="~{commons::settingtools}"></div>

    </div>
    <!-- end page container -->
    <!-- start footer -->
    <div th:replace="~{commons::footer}"></div>
    <!-- end footer -->


    <!--模态框-->
    <div class="modal fade" id="changeRoleModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
         aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">修改权限信息</h4>
                </div>
                <div class="modal-body">
                    <form id="updateUserForm">

                        <div class="form-group">
                            <label for="alterUid" class=" control-label">用户编号</label>
                            <div>
                                <input type="text" class="form-control" name="id" id="alterUid" placeholder="用户编号">
                            </div>
                        </div>


                        <div class="form-group">
                            <label for="alterUname" class="control-label">用户名：</label>
                            <div>
                                <input type="text" class="form-control" name="username" id="alterUname"
                                       placeholder="用户名">
                            </div>
                        </div>


                        <div class="form-group">
                            <label for="alterPassword" class="control-label">密码：</label>
                            <div>
                                <input type="text" class="form-control" name="password" id="alterPassword"
                                       placeholder="密码">
                            </div>
                        </div>


                        <div class="form-group">
                            <label class="control-label">角色：</label>
                            <select name="rid" class="form-control">
                                <option value="1">管理员</option>
                                <option value="2">前台</option>
                                <option value="3">VIP</option>
                                <option value="4">普通用户</option>
                            </select>
                        </div>


                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal" id="closeModal">关闭
                            </button>
                            <button type="button" class="btn btn-primary" id="update">
                                提交更改
                            </button>
                        </div>
                    </form>
                </div>
            </div><!-- /.modal-content -->

        </div><!-- /.modal -->
    </div>


</div>
<!-- start js include path -->
<script th:src="@{/assets/plugins/jquery/jquery.min.js}"></script>
<script th:src="@{/assets/plugins/popper/popper.min.js}"></script>
<script th:src="@{/assets/plugins/jquery-blockui/jquery.blockui.min.js}"></script>
<script th:src="@{/assets/plugins/jquery-slimscroll/jquery.slimscroll.min.js}"></script>
<!-- bootstrap -->
<script th:src="@{/assets/plugins/bootstrap/js/bootstrap.js}"></script>
<!-- Common js-->
<script th:src="@{/assets/js/app.js}"></script>
<script th:src="@{/assets/js/layout.js}"></script>
<script th:src="@{/assets/js/theme-color.js}"></script>
<!-- datatabes -->
<script th:src="@{/assets/plugins/datatables/jquery.dataTables.min.js}"></script>
<script th:src="@{/assets/plugins/datatables/plugins/bootstrap/dataTables.bootstrap4.min.js}"></script>
<script th:src="@{/assets/js/pages/table/table_data.js}"></script>
<!-- Material-->
<script th:src="@{/assets/plugins/material/material.min.js}"></script>
<!-- animatio -->
<script th:src="@{/assets/js/pages/ui/animations.js}"></script>


<script th:src="@{/assets/js/pages/extra_pages/all_users.js}"></script>
<!-- end js include path -->
</body>
</html>